Skip to content

🏷️ Render span identifiers as Typst labels#2698

Merged
rowanc1 merged 5 commits intojupyter-book:mainfrom
luukfroling:main
Mar 10, 2026
Merged

🏷️ Render span identifiers as Typst labels#2698
rowanc1 merged 5 commits intojupyter-book:mainfrom
luukfroling:main

Conversation

@luukfroling
Copy link
Contributor

update span handler to include node identifiers as Typst tags, which allows {index} to render properly.

update span renderer to include node identifiers as Typst tags
@changeset-bot
Copy link

changeset-bot bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: ca6b214

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
myst-to-typst Patch
myst-cli Patch
mystmd Patch
myst-migrate Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rowanc1
Copy link
Member

rowanc1 commented Feb 10, 2026

This looks good! Could you add a few test cases as well, they should be in the .yml files in the test directory.

@rowanc1 rowanc1 added the enhancement New feature or request label Feb 10, 2026
span(node, state) {
state.renderChildren(node, 0, { trimEnd: false });
if (node.identifier) {
state.write(` <${node.identifier}>`);
Copy link
Member

@rowanc1 rowanc1 Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a span, do we want the #label("${node.identifier}") syntax?

I am not sure...

https://typst.app/docs/reference/foundations/label

For example, if you have a labeled span in a header (silly, but maybe illustrative).

@luukfroling
Copy link
Contributor Author

@rowanc1 thanks for the review! I have added some test cases, and changes the typst syntax to #label() as I thought it made more sense. You were right about a labeled span in a header potentially breaking things, which is solved now.

I'm still getting familiar with typst, so if you have any other comments please let me know!

@luukfroling luukfroling requested a review from rowanc1 February 19, 2026 20:46
@FreekPols
Copy link
Contributor

@rowanc1 can you check whether all comments have sufficiently be addressed? Thnx in advance! (Luuk has not much time left on working on the project, hence the request)

@rowanc1 rowanc1 changed the title render span identifiers as Typst labels 🏷️ Render span identifiers as Typst labels Mar 10, 2026
Copy link
Member

@rowanc1 rowanc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, will wait for tests to go green then get this merged.

@rowanc1 rowanc1 merged commit 0b6ea12 into jupyter-book:main Mar 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants